package com.docking.heylo.web.controller;

import com.docking.heylo.service.ISysUserService;
import com.docking.heylo.web.dto.SysUserDto;
import com.docking.heylo.web.utils.ResultUtil;
import com.docking.heylo.web.vo.BaseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * 系统用户控制器
 */
@RestController
@RequestMapping("/user/")
public class SysUserController {

    @Autowired
    private ISysUserService sysUserService;

    /***
     * 获取登录用户信息
     *
     * @return
     */
    @RequestMapping("/userInfo")
    public BaseVo userInfo(){
        return ResultUtil.success("成功", sysUserService.userInfo());
    }

    /***
     * 修改登录密码
     *
     * @return
     */
    @RequestMapping("/editPassword")
    public BaseVo editPassword(@RequestBody @Validated(SysUserDto.EditPassword.class) SysUserDto userDto){
        sysUserService.editPassword(userDto);
        return ResultUtil.success("成功");
    }











}
